﻿using System;
using System.Collections.Generic;
using System.Text;

namespace PCR.Base
{
   /// <summary>
   /// Object collection interface
   /// </summary>
   /// <typeparam name="T">Object type</typeparam>
   public interface IObjectRepository<T>
   {
       /// <summary>
       /// Add a object
       /// </summary>
       /// <param name="item">Object to add</param>
       void Add(T item);
        
       /// <summary>
       /// Add a list of objects
       /// </summary>
       /// <param name="items">Object list</param>
       void Add(IList<T> items);
        
       /// <summary>
       /// Remove the object
       /// </summary>
       /// <param name="item">Object to remove</param>
       void Remove(T item);
       
       /// <summary>
       /// Remove the object by ID
       /// </summary>
       /// <param name="id">The object ID to remove</param>
       void RemoveByID(Guid id);

       /// <summary>
       /// Remove all the objects
       /// </summary>
       void RemoveAll();

       /// <summary>
       /// Modify the specified object
       /// </summary>
       /// <param name="item">Object to modify</param>
       void Modify(T item);
        
       /// <summary>
       /// Modify the object by ID
       /// </summary>
       /// <param name="id">The object ID to modify</param>
       /// <param name="item">The object to modify</param>
       void Modify(Guid id, T item);
       
       /// <summary>
       /// Get the object by ID
       /// </summary>
       /// <param name="id">The object ID</param>
       /// <returns>NULL if not found</returns>
       T GetByID(Guid id);
       
       /// <summary>
       /// Get all the object list
       /// </summary>
       IList<T> List { get; }

       /// <summary>
       /// Search the object by specified filter
       /// </summary>
       /// <param name="filter">Search filter, contains all the options to search</param>
       IList<T> Search(ISearchFilter<T> filter);
    }
}
